clc,clear all
% 三维图窗
figure
r=5;
scatter3(0,0,0,'r','filled');
xlabel('x');
ylabel('y');
zlabel('z');
% 绘制xy平面圆和绕x轴倾斜45度圆
hold on
circle_theta(r,pi/4);
hold on
circle_theta(r,0);
hold on
% 绘制重要的点
scatter3(3,0,0,'r','filled');
scatter3(3,4,0,'r','filled');
scatter3(3,2*sqrt(2),2*sqrt(2),'r','filled');
scatter3(3,2*sqrt(2),0,'r','filled');
% 绘制线段
plot3([-r,r],[0,0],[0,0]);
plot3([3,3],[0,4],[0,0]);
plot3([3,3],[0,2*sqrt(2)],[0,2*sqrt(2)]);
plot3([0,3],[0,2*sqrt(2)],[0,2*sqrt(2)]);
plot3([3,3],[2*sqrt(2),2*sqrt(2)],[0,2*sqrt(2)]);
% 标注
text(3,1,0.5,'\theta=45^\circ');
text(2,2,2,'\rho');
text(1.5,0,0,'x');
text(3,sqrt(2),0,'y');
text(3,2*sqrt(2),sqrt(2),'z');